let fetch = require("../../utils/fetch");
let mta = require('../../utils/mta_analysis.js');
let app = getApp();
Page({
	data: {
		num: '85',
		shopList: [],
		urlAddress: getApp().globalData.imageUrl

	},

	onLoad: function(options) {

	},

	onReady: function() {
		console.log('onReady')
	},
	onShow: function() {
		this.getShops()
	},
	onHide: function() {},
	onUnload: function() {

	},
	getShops: function() {
		var _self = this;
		wx.request({
			url: getApp().globalData.baseUrl + '/applet/maixiang/setting/stores.do',
			data: {

				shopCode: getApp().globalData.common.shopCode,
			},
			header: getApp().globalData.header,
			success: function(res) {
				if (res.data.code == 200) {
					console.log(res.data.obj)
					for (var i = 0; i < res.data.obj.length; i++) {
						if (res.data.obj[i].address.length > 36) {
							res.data.obj[i].address = res.data.obj[i].address.substring(0, 36) + '…'
						}

					}
					_self.setData({
						shopList: res.data.obj
					})

				} else {

				}



			},
			fail: function() {
				console.log(1)
			}
		})


	},
	 onShareAppMessage:function(){
        return {
		      title: '自定义转发标题',
		      path: '/page/user?id=123'
		    }
    },
	chooseAction: function(e) {
		console.log(e.currentTarget.dataset.code)
		shopCode: getApp().globalData.common.mxShopCode = e.currentTarget.dataset.code;
		wx.navigateBack({
			delta: 1
		})

	}

})